import router from '@r/index.js';
// export const useRouteNameToPage = routeName =>

//     router.push.bind(router, { name: routeName })
/**
 * @description 根据路由Name跳转
 * @param {*} routeName 
 * @returns 
 */
export const useRouteNameToPage = routeName =>
    router.push.bind(router, { name: routeName })

// export const useRouteNameToPage = routeName =>
//     router.push.bind(router, { name: routeName })

/**
 * @description 根据路由Path跳转
 * @param {*} routePath 
 * @returns 
 */
export const useRoutePathToPage = routePath =>
    router.push.bind(router, { path: routePath })


/**
 * @description 路由参数改变
 * @param {*} type 
 * @returns 
 */
export const useRouteParamChange = (type) => (value) =>
    router.push({ params: { [type]: value } })


export const useRouteNameWithQueryToPage = (
    name,
    type
) => query =>
        router.push({ name, query: { [type]: query } })
/**
 * 原来的函数需要这么写，返回一个promise 使用bind的函数，将router方进入就可以使用上面的方法来简写
 * export const useRouteNameToPage = routeName =>()=>
 * return router.push({ name: routeName })
 */
